package be.kdg.netpresentclient;

import javax.swing.*;
import java.awt.*;
/**
* Special Panel used to show extra info about the current slide. 
*
* @autor Timothy Huber, Joris Clevenbergs, Rik verschuren, Wim Van der Wilt
*/
public class InfoPanel extends JPanel {
	//Aanmaak en updaten van tekst infoveld onder de slide
	private static final long serialVersionUID = 1L;

	private JTextArea textArea; // JTextPane is enkel nodig bij formatted tekst
	
	/**
	* Constructor that creates and initializes the Infopanel. 
	*
	* @param Color color used as background of the panel.
	* @param size Dimention used to set the size of the panel.
	*/
	public InfoPanel(Color color, Dimension size) {
		textArea = new JTextArea();
		textArea.setBackground(color);
		textArea.setEditable(false);
		JScrollPane textScrollPane = new JScrollPane(textArea);
		textScrollPane.setBorder(null);
		textScrollPane
				.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		textScrollPane
				.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		textScrollPane.setPreferredSize(size);
		
		add(textScrollPane);

	}
	
	/**
	* Updates the text of the panel
	*
	* @param text  	takes the new text as a string and replaces
	* 				content of the panel with the new string.
	*/
	public void updateText(String text) {
		textArea.setText(text);
	}
}